//
//  MyView.swift
//  L01DrawLines
//
//  Created by liy on 2024/12/24.
//

import UIKit

class MyView: UIView {
  override func draw(_ rect: CGRect) {
    let ctx = UIGraphicsGetCurrentContext()
		ctx?.move(to: CGPointMake(100, 100))
		ctx?.addLine(to: CGPointMake(100, 200	))
		ctx?.addLine(to: CGPointMake(200, 200))
//		ctx?.strokePath() 可以使用一次strokePath就行
		
		ctx?.move(to: CGPointMake(100, 300))
		ctx?.addLine(to: CGPointMake(100, 400))
		ctx?.addLine(to: CGPointMake(200, 500))
		
//		配置线条属性
		ctx?.setStrokeColor(red: 1, green: 0, blue: 1, alpha: 1)
		ctx?.setLineWidth(5)
		ctx?.strokePath()
  }


}
